var express = require('express');
var router = express.Router();

let { getUsers, updateUsers, deleteUsers, addUsers,getUsersSubsidiary } = require('../service/usersService')
//查看我负责的所有客户
router.get('/getUsers', async function (req, res, next) {
    let data = await getUsers(req.query);
    res.send(data);
});
//修改客户信息
router.post('/updateUsers', async function (req, res, next) {
    res.send(await updateUsers(req.body));
});

//删除客户信息
router.post('/deleteUsers', async function (req, res, next) {
    res.send(await deleteUsers(req.body));
});
//新增客户
router.post('/addUsers', async function (req, res, next) {
    res.send(await addUsers(req.body));
});
//查看所属销售员
router.get('/getUsersSubsidiary', async function (req, res, next) {
    let data = await getUsersSubsidiary(req.query);
    res.send(data);
});

module.exports = router;
